package Vista;
import javax.swing.GroupLayout;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.LayoutStyle;

import javax.swing.WindowConstants;
import javax.swing.SwingUtilities;

import Controlador.ControEstudiante;


public class Vestudiante extends javax.swing.JFrame {
	public JPanel panelest;
	public JTextField txtced;
	public JLabel lblced;
	public JLabel lblnom;
	public JButton btnret;
	public JButton btnIns;
	public JTextField txtapellido;
	public JLabel lblape;
	public JTextField txtnombre;
	public JButton btnbuscar;

	public Vestudiante() {
		super();
		initGUI();
	}
	private ControEstudiante controest;
	
	private void initGUI() {
		try {
			GroupLayout thisLayout = new GroupLayout((JComponent)getContentPane());
			getContentPane().setLayout(thisLayout);
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			{
				panelest = new JPanel();
				GroupLayout panelestLayout = new GroupLayout((JComponent)panelest);
				panelest.setLayout(panelestLayout);
				{
					txtced = new JTextField();
				}
				{
					lblced = new JLabel();
					lblced.setText("Cedula:");
				}
				{
					btnbuscar = new JButton();
					btnbuscar.setText("Buscar");
				}
				{
					lblnom = new JLabel();
					lblnom.setText("Nombre:");
				}
				{
					txtnombre = new JTextField();
				}
				{
					lblape = new JLabel();
					lblape.setText("Apellido");
				}
				{
					txtapellido = new JTextField();
				}
				{
					btnIns = new JButton();
					btnIns.setText("Inscribir");
				}
				{
					btnret = new JButton();
					btnret.setText("Retirar");
				}
				panelestLayout.setHorizontalGroup(panelestLayout.createSequentialGroup()
					.addContainerGap(28, 28)
					.addGroup(panelestLayout.createParallelGroup()
					    .addGroup(GroupLayout.Alignment.LEADING, panelestLayout.createSequentialGroup()
					        .addGroup(panelestLayout.createParallelGroup()
					            .addComponent(lblced, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 76, GroupLayout.PREFERRED_SIZE)
					            .addGroup(GroupLayout.Alignment.LEADING, panelestLayout.createSequentialGroup()
					                .addComponent(lblape, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE)
					                .addGap(6))
					            .addGroup(GroupLayout.Alignment.LEADING, panelestLayout.createSequentialGroup()
					                .addComponent(lblnom, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE)
					                .addGap(6)))
					        .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
					        .addGroup(panelestLayout.createParallelGroup()
					            .addGroup(GroupLayout.Alignment.LEADING, panelestLayout.createSequentialGroup()
					                .addComponent(txtced, GroupLayout.PREFERRED_SIZE, 114, GroupLayout.PREFERRED_SIZE)
					                .addGap(20))
					            .addComponent(txtnombre, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 134, GroupLayout.PREFERRED_SIZE)
					            .addComponent(txtapellido, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 134, GroupLayout.PREFERRED_SIZE))
					        .addGap(0, 18, Short.MAX_VALUE)
					        .addComponent(btnbuscar, GroupLayout.PREFERRED_SIZE, 98, GroupLayout.PREFERRED_SIZE))
					    .addGroup(GroupLayout.Alignment.LEADING, panelestLayout.createSequentialGroup()
					        .addGap(52)
					        .addComponent(btnIns, GroupLayout.PREFERRED_SIZE, 94, GroupLayout.PREFERRED_SIZE)
					        .addGap(55)
					        .addComponent(btnret, GroupLayout.PREFERRED_SIZE, 87, GroupLayout.PREFERRED_SIZE)
					        .addGap(0, 56, Short.MAX_VALUE)))
					.addContainerGap(18, 18));
				panelestLayout.setVerticalGroup(panelestLayout.createSequentialGroup()
					.addContainerGap(51, 51)
					.addGroup(panelestLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
					    .addComponent(lblced, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)
					    .addComponent(txtced, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)
					    .addComponent(btnbuscar, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 31, GroupLayout.PREFERRED_SIZE))
					.addGap(17)
					.addGroup(panelestLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
					    .addComponent(txtnombre, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 29, GroupLayout.PREFERRED_SIZE)
					    .addComponent(lblnom, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 26, GroupLayout.PREFERRED_SIZE))
					.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
					.addGroup(panelestLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
					    .addComponent(txtapellido, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 28, GroupLayout.PREFERRED_SIZE)
					    .addComponent(lblape, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 24, GroupLayout.PREFERRED_SIZE))
					.addGap(31)
					.addGroup(panelestLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
					    .addComponent(btnret, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE)
					    .addComponent(btnIns, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 32, GroupLayout.PREFERRED_SIZE))
					.addContainerGap(38, 38));
			}
			thisLayout.setVerticalGroup(thisLayout.createSequentialGroup()
				.addComponent(panelest, 0, 270, Short.MAX_VALUE));
			thisLayout.setHorizontalGroup(thisLayout.createSequentialGroup()
				.addComponent(panelest, GroupLayout.PREFERRED_SIZE, 390, GroupLayout.PREFERRED_SIZE)
				.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 0, Short.MAX_VALUE));
			pack();
			setSize(400, 300);
		} catch (Exception e) {
		    //add your error handling code here
			e.printStackTrace();
		}
	


	acontroladora();
	

}
private void acontroladora() {
	
	controest = new ControEstudiante(this);
	btnbuscar.addActionListener(controest);
	btnIns.addActionListener(controest);
	btnret.addActionListener(controest);
}
}
